package com.yidu.best.stock.moneyTransfers.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * ID鐢熸垚鍣�
 * @author JLM
 *
 */
public class IDGenerator {

	public static void main(String[] args) {
		String uuid = UUID.randomUUID()
				.toString()
				.replace("-", "")
				.toUpperCase()
				.substring(0, 16);
		
		System.out.println(uuid);
	}
	
	/**
	 * 鑾峰緱ID
	 * @return 杩斿洖涓嶉噸澶嶇殑16浣嶅瓧绗︿覆
	 */
	public static String getId(){
		return UUID.randomUUID()   //鑾峰彇UUID
				.toString() //杞负瀛楃涓�
				.replace("-", "") //鍘婚櫎涓棿 -
				.toUpperCase() //杞负澶у啓
				.substring(0, 16); //鍙栧墠闈�16涓瓧绗�
	}
	public static String getNo(String type) {
		// ZJDB
		
		// ZQJY
		
		// GPJY
		Date date = new Date();
		DateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String no = df.format(date).substring(0,4);
		String no2 = df.format(date).substring(17);
		return type+"-"+ no + "-" +no2;
	}
	
	
}
	